//
// Created by Tony on 2024/5/29.
//

#ifndef RT_DATA_STACK_H
#define RT_DATA_STACK_H

#include <cstdint>
#include <memory>

namespace RtData {

using std::shared_ptr;
class Frame;

class Stack {
    uint32_t mMaxSize;
    uint32_t mSize;
    shared_ptr<Frame> mTopFrame;
    uint32_t mPC;

public:
    explicit Stack(uint32_t maxSize);

    void push(const shared_ptr<Frame>& frame);
    shared_ptr<Frame> pop();
    shared_ptr<Frame> top();

    bool isEmpty();

    uint32_t getPC() const { return mPC; };
    void setPC(uint32_t pc) { mPC = pc; }
};

} // namespace RtData

#endif // RT_DATA_STACK_H
